package com.hp.team.bookstore.model.order;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.hp.team.bookstore.model.catalog.Product;

@Entity
@Table(name = "INVENTORY_STOCK")
public class InventoryStock{
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "ID")
	private long id;
	
	@OneToOne
	@JoinColumn(name="BOOK_ID")
	private Product book;
	
	@Column(name = "AVAILABLE_TO_PURCHASE_QUANTITY")
	private int availableToPurchaseQuantity;
	
	@OneToMany(mappedBy="inventoryStock", cascade=CascadeType.ALL)
	private Set<InventoryItemInfo> inventoryItemsInfo = new HashSet<InventoryItemInfo>();
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Product getBook() {
		return book;
	}

	public void setBook(Product book) {
		this.book = book;
	}

	public int getAvailableToPurchaseQuantity() {
		return availableToPurchaseQuantity;
	}

	public void setAvailableToPurchaseQuantity(int availableToPurchaseQuantity) {
		this.availableToPurchaseQuantity = availableToPurchaseQuantity;
	}

	public Set<InventoryItemInfo> getInventoryItemsInfo() {
		return inventoryItemsInfo;
	}

	public void setInventoryItemsInfo(Set<InventoryItemInfo> inventoryItemsInfo) {
		this.inventoryItemsInfo = inventoryItemsInfo;
	}
}
